public class quickSort {

    public static void quickSort(int[] elem){
        Sort(elem,0,elem.length-1);
    }
    public static void Sort(int[] elem, int left,int right){
        if (left >= right){
            return;
        }
        int par = seekpar(elem,left,right);

        Sort(elem,left,par-1);

        Sort(elem,par+1,right);

    }
    public static int seekpar(int[] elem,int low,int high){
        int pivot = elem[low];
        int i = low;

        while (low < high){
            while (elem[high] >= pivot && low < high){
                high--;
            }
            while (elem[low] <= pivot && low < high){
                low++;
            }

            swap(elem,low,high);
        }
        swap(elem,low,i);
        return low;
    }

    public static void swap(int[] array,int i,int j){
        int cur = array[i];
        array[i] = array[j];
        array[j] = cur;
    }
}
